package com.study.qqclient.service;

import java.util.HashMap;

//管理客户端和服务器端通讯的线程
public class ManageClientContentServiceThread {
    //使用HashMap管理, key: userId, value: ClientConnectServerThread
    private static HashMap<String, ClientConnectServerThread> hm = new HashMap<>();

    public static void addClientConnectServerThread(String userId, ClientConnectServerThread clientConnectServerThread) {
        hm.put(userId, clientConnectServerThread);
    }

    public static ClientConnectServerThread getClientConnectServerThread(String userId) {
        return hm.get(userId);
    }

    public static void removeClientConnectServerThread(String userId) {
        hm.remove(userId);
    }

    public static void showOnlineUser() {
        System.out.println("在线用户列表");
        for (String key : hm.keySet()) {
            System.out.println(key);
        }
    }

}
